package com.hc.web.dao;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hc.web.entity.MyTable;
import com.hc.web.mapper.MyTableMapper;
import com.hc.cursorutils.CursorPageBaseReq;
import com.hc.cursorutils.CursorPageBaseResp;
import com.hc.cursorutils.CursorUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hc
 * @since 2024-12-05
 */
@Service
public class MyTableDao extends ServiceImpl<MyTableMapper, MyTable> {
    public CursorPageBaseResp<MyTable> getPage(String target, CursorPageBaseReq cursorPageBaseReq) {
        return CursorUtils.getCursorPageByMysql(this, cursorPageBaseReq, wrapper -> {
            wrapper.eq(MyTable::getTarget, target);
        }, MyTable::getId);
    }

    public List<MyTable> listByTableIds(List<Integer> roomIds) {
        return lambdaQuery()
                .in(MyTable::getId, roomIds)
                .list();
    }
}
